package com.douyin.controller;

// import com.douyin.service.BrowserPool; // 已禁用
import com.douyin.common.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 系统监控控制器 - 第三方API模式
 */
@Slf4j
@RestController
@RequestMapping("/api/monitor")
public class MonitorController {

    // private final BrowserPool browserPool; // 已禁用

    public MonitorController() {
        // 第三方API模式不需要BrowserPool
    }

    /**
     * 获取系统状态 (替换原浏览器池状态)
     */
    @GetMapping("/browser-pool")
    public Result<Map<String, Object>> getSystemStatus() {
        Map<String, Object> status = new HashMap<>();
        status.put("mode", "third-party-api");
        status.put("browserPoolStatus", "已禁用");
        status.put("apiStatus", "第三方API模式");
        status.put("performance", "高性能模式");
        status.put("timestamp", System.currentTimeMillis());
        
        return Result.success(status);
    }

    /**
     * 系统健康检查
     */
    @GetMapping("/health")
    public Result<Map<String, Object>> healthCheck() {
        Map<String, Object> health = new HashMap<>();
        health.put("status", "UP");
        health.put("mode", "third-party-api");
        health.put("browserPool", "已禁用 - 改用第三方API");
        health.put("resourceUsage", "低内存占用");
        health.put("performance", "高性能");
        health.put("timestamp", System.currentTimeMillis());
        
        return Result.success(health);
    }
}